﻿/*
 * 文件名称：
 * 程序员：yylu
 * 创建时间：2008/06/10
 * 
 * 功能说明：静态文件发布
 * 
 * 修改人员：
 * 
 * 修改日期：
 *      
 * 修改记录：
 */

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Whir.Publish;
using System.Text;

public partial class Whir_System_Module_Publish_PublishManage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RoleHelper.IsLogin();    //登录判断

        EzCalender1.Value = GetFirstDayOfMonth().ToShortDateString();
        EzCalender2.Value = GetLastDayOfMonth().ToShortDateString();

        txtChkValue.Style.Add("display", "none");
    }


    #region 得到一个月的第一天和最后一天的日期

    /// <summary> 
    /// 得到本月的第一天日期 
    /// </summary> 
    /// <returns>DateTime</returns> 
    public static DateTime GetFirstDayOfMonth()
    {
        return GetFirstDayOfMonth(DateTime.Now);
    }

    /// <summary> 
    /// 得到本月的最有一天的日期 
    /// </summary> 
    /// <returns>DateTime</returns> 
    public static DateTime GetLastDayOfMonth()
    {
        return GetLastDayOfMonth(DateTime.Now);
    }

    /// <summary> 
    /// 得到一个月的第一天 
    /// </summary> 
    /// <param name="someday">这个月的随便一天</param> 
    /// <returns>DateTime</returns> 
    public static DateTime GetFirstDayOfMonth(DateTime someday)
    {
        int totalDays = DateTime.DaysInMonth(someday.Year, someday.Month);
        DateTime result;
        int ts = 1 - someday.Day;
        result = someday.AddDays(ts);
        return result;
    }

    /// <summary> 
    /// 得到一个月的最后一天 
    /// </summary> 
    /// <param name="someday">这个月的随便一天</param> 
    /// <returns>DateTime</returns> 
    public static DateTime GetLastDayOfMonth(DateTime someday)
    {
        int totalDays = DateTime.DaysInMonth(someday.Year, someday.Month);
        DateTime result;
        int ts = totalDays - someday.Day;
        result = someday.AddDays(ts);
        return result;
    }

    #endregion 

}
